-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(HMS-1245): UI AWS permission check #292
Conversation
Env Build error. Running test again. |
Do you have a screenshot of the error message? :-) |
2b59eca
to
b3e6ce9
Compare
/retest |
@amirfefer have another PR where he shows a warning message in a different format, please talk to each other and pick one style. Nitpick: join the permissions with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did we test this with Azure? The request for permissions will probably fail, right, do we handle it gracefully? The code doesn't seem to do this explicitly, so at minimum it reads bad, because we run checkAWSPerms
for all providers.
Just a thought (feel free to ignore): did you think about checking the permissions reactively, maybe when we get AWS error. In that way we would save up a request to API and AWS, I do not think it's strictly necessary and this might be a better solution :)
src/Components/ProvisioningWizard/steps/ReservationProgress/index.js
Outdated
Show resolved
Hide resolved
Yes, for AWS it means parsing string error and trying to figure out what was wrong. Not too clean. But good point - this must not break Azure/GCP and it should be implemented in a way that we can easily add the same support into Azure/GCP too. |
This is bad, needs to be fixed. |
Thanks @avitova! My concern is it might confuse users. AFAIK, the error doesn't have to be related to the missing permission, the error message is hidden, but the warning is highlighted, advice from @MariSvirik would help :) |
src/Components/ProvisioningWizard/steps/ReservationProgress/index.js
Outdated
Show resolved
Hide resolved
I take my comments on the warning UI back, @amirfefer explained why it is difficult to implement warnings as we would like to. Let’s focus that on later, for now this is a good enough solution. Summary from our discussion:
|
If the permissions are missing launch will fail, correct? @lzap what would be that extra step? Do you envision it living inside the wizard? |
@MariSvirik No, they will not. Users could set their permissions according to our recommendations, and in that case, we'd be able to find out missing permissions accurately. |
Now that I think about it, I think the alternative (and maybe better) solution to this is to take this check few screens before when a source is selected. After source is selected, we can trigger an event of requesting source permission check and display a warning there. What you all think? @ezr-ondrej @amirfefer @avitova @MariSvirik |
@lzap that would be great. |
Tens of milliseconds. |
b3e6ce9
to
f58cbbd
Compare
/retest |
1 similar comment
/retest |
@avitova How can users fix it? We should tell them. |
{missingPermissions.length != 0 && ( | ||
<HelperText> | ||
<HelperTextItem variant="warning"> | ||
Warning: Launch may fail, the following permissions are missing: {missingPermissions.join(', ')} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Warning: Launch may fail, the following permissions are missing: {missingPermissions.join(', ')} | |
Warning: Launch can fail, the following permissions are missing: {missingPermissions.join(', ')} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @avitova, looks great!
For marking the select warning validation, you can propagate a validate
prop with a warning
value to the source select component.
I guess in some cases the list of missing permissions might be long for a helperText, an ExpandedSection
like @MariSvirik suggested sounds like a nice solution, also adding some further information on how to add the permissions in the expanded section. You can combine the ExpandedSection with the helperText component by using the toggleContent
prop., as you can see in this live demo
src/Components/ProvisioningWizard/steps/ReservationProgress/index.js
Outdated
Show resolved
Hide resolved
f58cbbd
to
6879fd9
Compare
|
@avitova my proposal: |
f191734
to
d610f0b
Compare
d610f0b
to
7e0f63c
Compare
7e0f63c
to
a10baad
Compare
Idea: Implement some limit, if list of missing permission is longer than let’s say 5 you can generate: perm1, perm2, perm3 and 2 more. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @avitova! It looks great!
I left a few inline comments, mostly nitpicks, and also please verify that the form validation is not broken due to the default
addition to the region field.
<p> | ||
Check if <a href="https://console.aws.amazon.com/iam/">policies</a> in your {image.provider} account for the selected region are set | ||
as{' '} | ||
<a href="https://github.com/RHEnVision/provisioning-backend/blob/main/docs/configure-amazon-role.md#service-account-policy"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it would be better to link to formal red hat docs, not dev docs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree. We do not have the list in the RedHat docs, though. 🤔 And it is one more place we'd have to change in case of changed expected policy. We could use this link but that is quite a lot of steps to only access needed permission list.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we ... in theory... have the permission list extracted to a file in the backend and load it in code here on the build time - or figure out how to load it to documentation on build time?
We can also play with it as next step tho. I'd either link Sources directly with "Make sure you're following the steps while creating source", or link the official sources documentation with similar message 🤷
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Linking to developer docs is not terrible, just not profesional, but given we are explaining the process quite deeply there I'm mostly worried customers might get confused by all the info there :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure how we'd want to show the long list here. The link seems like the only sensible option, but I am open if you see a way to show it. We could have one more expandable section with the required permissions if that makes sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking of Popup, but I agree it's not great, let's just link the official doc, for now. Or split up the developer docs to User and Maintainer oriented docs 🤔 but honestly I think the best way is to link the official docs and as follow-up figure out how to pull the information there directly from our repo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you suggest we hardcode the list of permissions to the official docs for now? Yeah, we could do that, and add it to the [https://github.com/RHEnVision/provisioning-backend/blob/main/CONTRIBUTING.md#basic-guidelines-for-code-contributions](list of places to change).
At the moment, we need to load the permission list to:
- Go file
- Javascript file
- yaml
- markdown
And we can try to eliminate some of these. 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm suggesting to split the IAM policy: RHEnVision/provisioning-backend#682 and then include it on build time here.
But I'm more then happy to leave it to a follow-up :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Contributing guide is perfect first step for sure :)
types: chosenInstanceType ? 'success' : 'default', | ||
amount: 'success', | ||
region: 'default', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep in mind that the default
validation means that the field is just set and is not validated yet. we use this validations state for the entire form validation, if one field is marked as default
or error
the form is not validated, and the Next button will be disabled.
What is the state here? :) it needs rebase now, but apart of that I guess we are almost ready? |
The best way to test this is to insert a new permission and use your local backend.